# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-ipcalc
pkgname=('python2-ipcalc' 'python-ipcalc')
_pkgname=ipcalc
pkgver=1.99.0
pkgrel=10
epoch=1
pkgdesc='IP subnet calculator for Python.'
arch=('any')
url='https://pypi.org/project/ipcalc/#files'
license=('custom:unknown')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('14317b10775e7169633419ff46caf8da693efb0b46e3baced31adf1e7ed389cba9f8c265cc515b20062bf992bcf8e931fffe12d6656dad11585444d6e445b224')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-ipcalc() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-ipcalc() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

